﻿<%@ Page Language="C#" MasterPageFile="~/design/UmelecM.Master" AutoEventWireup="true"
    CodeFile="Serie.aspx.cs" Inherits="Zadani09.umelec.Serie" Title="Správa sérií" %>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="LoginPlaceholder" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MenuPlaceholder" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentVrchniPlaceholder" runat="server">
    <h2 style="margin-bottom: 2px">Seznam sérií</h2>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" RenderMode="Inline">
        <ContentTemplate>
            <asp:TextBox ID="TextBox1" runat="server">
            </asp:TextBox>
            <cc1:AutoCompleteExtender ID="TextBox1_AutoCompleteExtender" runat="server" 
                DelimiterCharacters="" Enabled="True" ServicePath="" TargetControlID="TextBox1" 
                UseContextKey="True" ServiceMethod="GetCompletionList" 
                MinimumPrefixLength="1">
            </cc1:AutoCompleteExtender>
            &nbsp;
            <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True">
                <asp:ListItem Value="id_serie" Text="ID Série">
                </asp:ListItem>
                <asp:ListItem Value="id_umelec" Text="ID Umělec">
                </asp:ListItem>
                <asp:ListItem Value="nazev" Text="Název">
                </asp:ListItem>
                <asp:ListItem Value="popis" Text="Popis">
                </asp:ListItem>
                <asp:ListItem Value="dlouhy_popis" Text="Dlouhý popis">
                </asp:ListItem>
            </asp:DropDownList>
        </ContentTemplate>
    </asp:UpdatePanel>
    &nbsp;
    <asp:Button ID="Button1" runat="server" Text="Vyhledat" Font-Size="12px" onclick="Button1_Click" />
    <asp:GridView ID="GridView1" runat="server" BackColor="LightGoldenrodYellow" BorderColor="Tan"
        BorderWidth="1px" CellPadding="2" ForeColor="Black" GridLines="None" Width="740px"
        AllowPaging="True" AutoGenerateColumns="False" DataSourceID="ObjectDataSource1"
        DataKeyNames="IDSerie" CssClass="mar_top_3" onselectedindexchanged="GridView1_SelectedIndexChanged">
        <FooterStyle BackColor="Tan" />
        <Columns>
            <asp:CommandField SelectText="Detail" ShowSelectButton="True" 
                DeleteText="Smazat" ShowDeleteButton="True">
                <ItemStyle Font-Bold="True" />
            </asp:CommandField>
            <asp:BoundField DataField="IDSerie" HeaderText="ID" SortExpression="IDSerie" />
            <asp:BoundField DataField="IDUmelec" HeaderText="ID umělce" SortExpression="IDUmelec" />
            <asp:BoundField DataField="Nazev" HeaderText="Název" SortExpression="Nazev" />
            <asp:BoundField DataField="DlouhyPopis" HeaderText="Dlouhý popis" SortExpression="DlouhyPopis"
                Visible="False" />
            <asp:BoundField DataField="Popis" HeaderText="Popis" SortExpression="Popis" Visible="False" />
        </Columns>
        <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
        <HeaderStyle BackColor="Tan" Font-Bold="True" />
        <AlternatingRowStyle BackColor="PaleGoldenrod" />
    </asp:GridView>
    <h2 style="margin-bottom: 2px">Přidání a editace série</h2>
    <asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="417px" AutoGenerateRows="False"
        BackColor="LightGoldenrodYellow" BorderColor="Tan" BorderWidth="1px" CellPadding="2"
        ForeColor="Black" GridLines="None" DataSourceID="ObjectDataSource2" DataKeyNames="IDSerie">
        <FooterStyle BackColor="Tan" />
        <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" HorizontalAlign="Center" />
        <Fields>
            <asp:BoundField DataField="IDSerie" HeaderText="ID" ReadOnly="True" 
                SortExpression="IDSerie" InsertVisible="False">
                <HeaderStyle Font-Bold="True" />
            </asp:BoundField>
            <asp:TemplateField HeaderText="ID umělce" SortExpression="IDUmelec">
                <EditItemTemplate>
                    <asp:DropDownList ID="DropDownList3" runat="server" 
                        DataSourceID="ObjectDataSource3" DataTextField="Prijmeni" 
                        DataValueField="IDUmelec" Height="20px" SelectedValue='<%# Bind("IDUmelec") %>' 
                        Width="150px">
                    </asp:DropDownList>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:DropDownList ID="DropDownList2" runat="server" 
                        DataSourceID="ObjectDataSource3" DataTextField="Prijmeni"
                        DataValueField="IDUmelec" Height="20px" SelectedValue='<%# Bind("IDUmelec") %>' 
                        Width="150px">
                    </asp:DropDownList>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("IDUmelec") %>'></asp:Label>
                </ItemTemplate>
                <HeaderStyle Font-Bold="True" />
            </asp:TemplateField>
            <asp:BoundField DataField="Nazev" HeaderText="Název" SortExpression="Nazev">
                <HeaderStyle Font-Bold="True" />
            </asp:BoundField>
            <asp:BoundField DataField="Popis" HeaderText="Popis" SortExpression="Popis">
                <HeaderStyle Font-Bold="True" />
            </asp:BoundField>
            <asp:BoundField DataField="DlouhyPopis" HeaderText="Dlouhý popis" SortExpression="DlouhyPopis">
                <HeaderStyle Font-Bold="True" />
            </asp:BoundField>
            <asp:CommandField InsertText="Vložit" NewText="Vložit novou sérii" ShowEditButton="True"
                ShowInsertButton="True" UpdateText="Aktualizuj">
                <HeaderStyle Font-Bold="True" ForeColor="Red" />
                <ItemStyle Font-Bold="True" ForeColor="Red" />
            </asp:CommandField>
        </Fields>
        <HeaderStyle BackColor="Tan" Font-Bold="True" />
        <EditRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
        <AlternatingRowStyle BackColor="PaleGoldenrod" />
    </asp:DetailsView>
    <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" DataObjectTypeName="Zadani09.db.Serie"
        OldValuesParameterFormatString="original_{0}" SelectMethod="ctiJednu" TypeName="Zadani09.db.ODS.SerieDataObject"
        UpdateMethod="aktualizuj" InsertMethod="vloz">
        <SelectParameters>
            <asp:ControlParameter ControlID="GridView1" DefaultValue="1" Name="id" PropertyName="SelectedValue"
                Type="Int32" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DataObjectTypeName="Zadani09.db.Serie"
        DeleteMethod="smaz" OldValuesParameterFormatString="original_{0}" SelectMethod="cti_s_vyhledavanim"
        TypeName="Zadani09.db.ODS.SerieDataObject">
        <SelectParameters>
            <asp:Parameter Name="razeni" Type="String" />
            <asp:ControlParameter ControlID="TextBox1" DefaultValue="" Name="hledano" PropertyName="Text" Type="String" />
            <asp:ControlParameter ControlID="DropDownList1" DefaultValue="id_umelec" Name="atribut" PropertyName="SelectedValue" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="ObjectDataSource3" runat="server" 
        OldValuesParameterFormatString="original_{0}" SelectMethod="cti" 
        TypeName="Zadani09.db.ODS.UmelecDataObject">
        <SelectParameters>
            <asp:Parameter Name="razeni" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <h2 style="margin-bottom: 2px">Díla v sérii</h2>
    <asp:GridView ID="GridView2" runat="server" AllowPaging="True" 
        AutoGenerateColumns="False" BackColor="LightGoldenrodYellow" BorderColor="Tan" 
        BorderWidth="1px" CellPadding="2" DataSourceID="ObjectDataSource4" 
        ForeColor="Black" GridLines="None" DataKeyNames="IDDilo" Width="600px">
        <FooterStyle BackColor="Tan" />
        <Columns>
            <asp:BoundField DataField="IDDilo" HeaderText="IDDilo" 
                SortExpression="IDDilo" />
            <asp:BoundField DataField="Nazev" HeaderText="Nazev" SortExpression="Nazev" />
            <asp:BoundField DataField="Datum" HeaderText="Datum" SortExpression="Datum" />
            <asp:BoundField DataField="Ulice" HeaderText="Ulice" SortExpression="Ulice" />
            <asp:BoundField DataField="Popisne" HeaderText="Č.p." 
                SortExpression="Popisne" />
            <asp:BoundField DataField="Mesto" HeaderText="Mesto" SortExpression="Mesto" />
            <asp:BoundField DataField="PSC" HeaderText="PSC" SortExpression="PSC" />
            <asp:BoundField DataField="NaProdej" HeaderText="NaProdej" 
                SortExpression="NaProdej" />
            <asp:BoundField DataField="Popis" HeaderText="Popis" SortExpression="Popis" 
                Visible="False" />
            <asp:BoundField DataField="DlouhyPopis" HeaderText="DlouhyPopis" 
                SortExpression="DlouhyPopis" Visible="False" />
        </Columns>
        <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" 
            HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
        <HeaderStyle BackColor="Tan" Font-Bold="True" />
        <AlternatingRowStyle BackColor="PaleGoldenrod" />
    </asp:GridView>
    
    <asp:ObjectDataSource ID="ObjectDataSource4" runat="server" OldValuesParameterFormatString="original_{0}" 
        SelectMethod="dila_v_serii" TypeName="Zadani09.db.ODS.SerieDiloDataObject" 
        DeleteMethod="smaz_dilo_ze_serie">
        <DeleteParameters>
            <asp:ControlParameter ControlID="GridView1" Name="serie" 
                PropertyName="SelectedValue" Type="Int32" />
            <asp:ControlParameter ControlID="DropDownList5" Name="dilo" 
                PropertyName="SelectedValue" Type="Int32" />
        </DeleteParameters>
        <SelectParameters>
            <asp:ControlParameter ControlID="GridView1" Name="serie" 
                PropertyName="SelectedValue" Type="Int32" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:Panel ID="Panel1" runat="server">
   <h2 style="margin-bottom: 2px">Přidání & Odebrání děl do série</h2>
    </asp:Panel>
    <asp:DropDownList ID="DropDownList4" runat="server" 
        DataSourceID="ObjectDataSource5" DataTextField="Nazev" DataValueField="IDDilo" 
        Height="20px" Width="150px">
    </asp:DropDownList>
    <asp:Button ID="Button2" runat="server" Text="Přidat dílo do série" 
        Height="26px" Width="182px" />
    
    <br />
    <asp:DropDownList ID="DropDownList5" runat="server" 
        DataSourceID="ObjectDataSource4" DataTextField="Nazev" DataValueField="IDDilo" 
        Height="20px" Width="150px">
    </asp:DropDownList>
    <asp:Button ID="Button3" runat="server" Text="Odebrat dílo ze série" 
        Height="26px" Width="182px" />
    <asp:ObjectDataSource ID="ObjectDataSource5" runat="server" 
        InsertMethod="prirad_dilo_do_serie" 
        OldValuesParameterFormatString="original_{0}" SelectMethod="dila_ne_v_serii" 
        TypeName="Zadani09.db.ODS.SerieDiloDataObject">
        <SelectParameters>
            <asp:ControlParameter ControlID="GridView1" Name="serie" 
                PropertyName="SelectedValue" Type="Int32" />
        </SelectParameters>
        <InsertParameters>
            <asp:ControlParameter ControlID="GridView1" Name="serie" 
                PropertyName="SelectedValue" Type="Int32" />
            <asp:ControlParameter ControlID="DropDownList4" Name="dilo" 
                PropertyName="SelectedValue" Type="Int32" />
        </InsertParameters>
    </asp:ObjectDataSource>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ContentSpodniPlaceholder" runat="server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="BottomPlaceholder" runat="server">
</asp:Content>
